/**
 * 
 */
package com.geekteam.manga.wiget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.geekteam.imageloader.core.DisplayImageOptions;
import com.geekteam.imageloader.core.ImageLoader;
import com.geekteam.manga.R;

/**
 * @author MtRol
 * 
 */
public class GImageView extends ImageView {

	DisplayImageOptions mOption;

	public GImageView(Context context) {
		super(context);
		oprionBuilder();
	}

	public GImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		oprionBuilder();
	}

	public GImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		oprionBuilder();
	}

	private void oprionBuilder(){
		mOption = new DisplayImageOptions.Builder()
		.showStubImage(R.drawable.book_default).cacheInMemory()
		.cacheOnDisc().build();
	}
	
	public void setImageFromServer(String url) {
		ImageLoader.getInstance().displayImage(url, this, mOption);
	}

}
